from typing import Optional

from sqlalchemy import CHAR, DateTime, Float, Index, Integer, String, Text
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
import datetime

from common.sqlalchemy_db import SqlalchemyX


class User(SqlalchemyX.Base):
    __tablename__ = 'user'

    user_name: Mapped[str] = mapped_column(String(50))
    user_saltPassword: Mapped[str] = mapped_column(String(1024))
    user_avatar: Mapped[str] = mapped_column(CHAR(255))
    user_reg_time: Mapped[datetime.datetime] = mapped_column(DateTime)
    user_state: Mapped[int] = mapped_column(Integer)
    user_id: Mapped[str] = mapped_column(String, primary_key=True)
    user_lastLogin_time: Mapped[Optional[datetime.datetime]] = mapped_column(DateTime)
    user_socketId: Mapped[Optional[int]] = mapped_column(Integer)
    user_preferSetting_id: Mapped[Optional[int]] = mapped_column(Integer)